﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace PBDesk.Framework.WebUI
{
    public static class CookieHelper
    {
        #region CookieName Constants
        public const string COOKIE_USER = "UserInfo";
        public const string COOKIE_USER_NAME = "UserName";
        public const string COOKIE_AUTH = "AuthInfo";
        public const string COOKIE_AUTH_PROVIDER_ID = "AuthProivderId";
        public const string COOKIE_AUTH_PROVIDER_NAME = "AuthProivder";
        public const string COOKIE_AUTH_SERVICE_PROVIDER_NAME = "AuthServiceProivder";
        #endregion

        public static void WriteAuthCookies(string authProivderId, string authProivder, string authServiceProivder)
        {
            CookieManager.WriteCookie(COOKIE_AUTH, new NameValueCollection 
                                                            {
                                                                {COOKIE_AUTH_PROVIDER_ID, authProivderId},
                                                                {COOKIE_AUTH_PROVIDER_NAME, authProivder},
                                                                {COOKIE_AUTH_SERVICE_PROVIDER_NAME, authServiceProivder}
                                                            });
        }

        public static void ReadAuthCookies(out string authProivderId, out string authProivder, out string authServiceProivder)
        {
            authProivderId = CookieManager.GetCookieValue(COOKIE_AUTH, COOKIE_AUTH_PROVIDER_ID);
            authProivder = CookieManager.GetCookieValue(COOKIE_AUTH, COOKIE_AUTH_PROVIDER_NAME);
            authServiceProivder = CookieManager.GetCookieValue(COOKIE_AUTH, COOKIE_AUTH_SERVICE_PROVIDER_NAME);
        }

        public static bool WriteUserInfoCookies(string userName)
        {
            return false;
        }

        public static void ReadUserInfoCookies(out string userName)
        {
            userName = string.Empty;
        }

        
    }
}
